var rownowsetdatacover=1;
function addformvdouploadcover(config)
{


    $("#addform").append('<div id="feature'+rowdiv+'" class="itPlg addVdoCvUlPlg featureclass" alt="'+rowdiv+'">'+dataform['vdouploadcover']+"</div>");
    var rownow=rowdiv;
    
  //console.log('#feature'+rownow+'  .linkvdobutton');
  
   $('#feature'+rownow+'  .linkvdobutton').iuploader({
         'link':serviceinfo+'iuploadfile',
         'accept':config.accept,
         'group':rownow,
         'type':config.allow,
         'onStartUpload':function(setting){
       //  $('#feature'+rownow+' .ico2.icoCrtGrn').hide();
    //     $('#feature'+rownow+' .btnIco.upAddIco').hide();
         
         var bytename=bytesToSize(setting['size'],2);
         $('#feature'+rownow+' .desPlg.clTxt3.fs03').html(bytename);
        // $('#feature'+rownow+' .fileName').html(setting['fileold']);
         },
         'load':$('#feature'+rownow+' .desPlg.clTxt3.fs03'),
         'finish':$('#feature'+rownow+' .ico2.icoCrtGrn'),
         'isimg':false,
         'onUploadFinish':function(filename,filelink,setting){
         
          $("#fileid-"+setting.id).val(setting.fileid);
          $("#fileold-"+setting.id).val(setting.fileold);
         
         // $('#feature'+rownow+' .fileName').html('<a href="'+filelink+'" target="'+filelink+'">'+setting.fileold+'</a>');
         
         
         
        $('#feature'+rownow+' .plgArea').html(' <video  width="100%" height="360"   controls><source src="'+filelink+'" type="video/mp4"></video>');
         
         

         //alert(filename);
         }
   });
   $('#feature'+rownow+' .deletevdobutton').click(function() {

   $('#feature'+rownow+' input[name="fileold[]"]').val('');
   $('#feature'+rownow+' input[name="fileid[]"]').val('');
   $('#feature'+rownow+' input[name="filelink[]"]').val('');
   $('#feature'+rownow+' .plgArea').html('');
   $('#feature'+rownow+' .desPlg.clTxt3.fs03').html('Explain more about your stuff by add some vdo clip for it');
   
   });
   $('#feature'+rownow+' .deleterowbutton').click(function(){
   
    $('#feature'+rownow).remove();
    
   });
   
   
   $('#feature'+rownow+' .imgvdobutton').click(function(){
 
 getcoverdata(rownow);
 

   
   });
   
    
    
    
    
    
    rowdiv++;

}

function saveformvdouploadcover(id,plugid)
{
var obj={};
if($("#"+id+' input[name="fileid[]"]').val()!="")
{
var rowdata=$("#"+id).attr('alt');
obj={
plugid:plugid,
fileid:$("#"+id+' input[name="fileid[]"]').val(),
detail:$("#"+id+' input[name="detail[]"]').val(),
simgmid:$('#imgdata-'+rowdata+' .image1 input[name="simgmid[]"]').val(),
imgmid:$('#imgdata-'+rowdata+' .image1 input[name="imgmid[]"]').val()

};
}

return obj;

}
function getformvdouploadcover(dataplugin)
{
var code="";
if(dataplugin.file.filename)
{
code +='<div class="wrpVdoLdcheckrow" id="uploadvdoid2-'+dataplugin['uploadid']+'">\n';
code += '<div class="ldIt wrpVdoLd clBg4 w640 " id="uploadvdoid-'+dataplugin['uploadid']+'">\n';

code+='<video width="100%" height="360" id="uploadvdoidsetscript-'+dataplugin['uploadid']+'" src="'+dataplugin.file.newpath+'" controls><source src="'+dataplugin.file.newpath+'" type="video/mp4"></video>';


code += '</div>';
code += '</div>';

}


return code;

}
function editformvdouploadcover(config,datarow)
{
    if(datarow.fileid!="0")
    {
     addformvdouploadcover(config);
     var rownow= rowdiv-1;
      
       $('#feature'+rownow+' input[name="fileid[]"]').val(datarow.fileid);
       $('#feature'+rownow+' input[name="detail[]"]').val(datarow.detail);
       $('#feature'+rownow+' .plgArea').html(' <video  width="100%" height="360"  controls><source src="'+datarow.file.newpath+'" type="video/mp4"></video>');
       
       getcoverdata(rownow,1);
       
       $('#imgdata-'+rownow+' .image1 input[name="simgmid[]"]').val(datarow.simgmid);
       $('#imgdata-'+rownow+' .image1 input[name="imgmid[]"]').val(datarow.imgmid);
       $('#imgdata-'+rownow+' .image1 .plgAreaThumbnail').html('<a target="_blank" href="'+datarow.img.newpath+'?t='+Math.floor((Math.random()*100000)+1)+'"><img  width="150" src="'+datarow.simg.newpath+'?t='+Math.floor((Math.random()*100000)+1)+'"></a>');
       



    }
       
}